package com.gitee.luosl.cola.lang.function.checked;

import java.util.function.ToIntFunction;

public interface CheckedToIntFunction<T> {

    int applyAsInt(T value) throws Throwable;

    default ToIntFunction<T> asToIntFunction(){
        return i -> {
            try {
                return applyAsInt(i);
            }catch (Throwable throwable){
                throw new CheckedException(throwable);
            }
        };
    }
}
